﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:my="clr-namespace:WP7Chess.Converters" xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:im="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions" 
    x:Class="WP7Chess.SettingsPage"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True"
    xmlns:local="clr-namespace:WP7Chess"
    local:TiltEffect.IsTiltEnabled="True">
    <phone:PhoneApplicationPage.Resources>
        <my:EnumToBoolean x:Key="enumToBoolean" />
    	<Storyboard x:Name="OpenStoryboard">
    		<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="PageTitle">
    			<EasingDoubleKeyFrame KeyTime="0" Value="-90"/>
    			<EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0">
    				<EasingDoubleKeyFrame.EasingFunction>
    					<CubicEase EasingMode="EaseInOut"/>
    				</EasingDoubleKeyFrame.EasingFunction>
    			</EasingDoubleKeyFrame>
    		</DoubleAnimationUsingKeyFrames>
    		<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="PageTitle">
    			<EasingDoubleKeyFrame KeyTime="0" Value="-220"/>
    			<EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0">
    				<EasingDoubleKeyFrame.EasingFunction>
    					<CubicEase EasingMode="EaseInOut"/>
    				</EasingDoubleKeyFrame.EasingFunction>
    			</EasingDoubleKeyFrame>
    		</DoubleAnimationUsingKeyFrames>
    		<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ContentPanel">
    			<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
    			<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1">
    				<EasingDoubleKeyFrame.EasingFunction>
    					<CubicEase EasingMode="EaseInOut"/>
    				</EasingDoubleKeyFrame.EasingFunction>
    			</EasingDoubleKeyFrame>
    		</DoubleAnimationUsingKeyFrames>
    	</Storyboard>
    </phone:PhoneApplicationPage.Resources>
 
    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>
	<phone:PhoneApplicationPage.ApplicationBar>
		<shell:ApplicationBar>
			<shell:ApplicationBarIconButton IconUri="/icons/appbar.check.rest.png" IsEnabled="True" Text="apply" x:Name="Apply" Click="Apply_Click"/>
		</shell:ApplicationBar>
	</phone:PhoneApplicationPage.ApplicationBar>
	<Custom:Interaction.Triggers>
		<Custom:EventTrigger>
			<im:ControlStoryboardAction Storyboard="{StaticResource OpenStoryboard}"/>
		</Custom:EventTrigger>
	</Custom:Interaction.Triggers>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="{StaticResource appTitle}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="settings" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" RenderTransformOrigin="0.5,0.5">
            	<TextBlock.RenderTransform>
            		<CompositeTransform/>
            	</TextBlock.RenderTransform>
            	<TextBlock.Projection>
            		<PlaneProjection/>
            	</TextBlock.Projection>
            </TextBlock>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <StackPanel>
                <Border Margin="3" BorderThickness="3" BorderBrush="{StaticResource PhoneBorderBrush}">
                    <StackPanel>
                        <TextBlock Text="Player 2 (black) "/>
                        <RadioButton x:Name="p2csh" Content="Computer - C#" GroupName="p1" IsChecked="{Binding Player2, ConverterParameter=CSharp, Converter={StaticResource enumToBoolean}, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/>
                        <RadioButton x:Name="p2h" Content="Human" GroupName="p1" IsChecked="{Binding Player2, ConverterParameter=Human, Converter={StaticResource enumToBoolean}, Mode=TwoWay, UpdateSourceTrigger=Explicit}" />
                        <RadioButton x:Name="p2js" Content="Computer - JavaScript" IsEnabled="False" GroupName="p1" IsChecked="{Binding Player2, ConverterParameter=JavaScript, Converter={StaticResource enumToBoolean}, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/>
                    </StackPanel>
                </Border>
                <Border Margin="3" BorderThickness="3" BorderBrush="{StaticResource PhoneBorderBrush}">
                    <StackPanel>
                        <TextBlock Text="Player 1 (white)"/>
                        <RadioButton x:Name="p1csh" Content="Computer - C#" GroupName="p2" IsChecked="{Binding Player1, ConverterParameter=CSharp, Converter={StaticResource enumToBoolean}, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/>
                        <RadioButton x:Name="p1h" Content="Human" GroupName="p2" IsChecked="{Binding Player1, ConverterParameter=Human, Converter={StaticResource enumToBoolean}, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/>
                        <RadioButton x:Name="p1js" Content="Computer - JavaScript" IsEnabled="False" GroupName="p2" IsChecked="{Binding Player1, ConverterParameter=JavaScript, Converter={StaticResource enumToBoolean}, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/>
                    </StackPanel>
                </Border>
            </StackPanel>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>
